package com.example.file_management.service;

import com.example.file_management.mapper.material.AssessmentMapper;
import com.example.file_management.pojo.material.Assessment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class AssessmentService {

    private final AssessmentMapper assessmentMapper;

    @Autowired
    public AssessmentService(AssessmentMapper assessmentMapper) {
        this.assessmentMapper = assessmentMapper;
    }

    // 插入评估记录
    public int insertAssessment(Assessment assessment) {
        return assessmentMapper.insertAssessment(assessment);
    }

    // 根据任务ID查询评估记录
    public List<Assessment> getAssessmentsByTaskId(int taskId) {
        return assessmentMapper.getAssessmentsByTaskId(taskId);
    }

    // 更新评估记录
    public int updateAssessment(Assessment assessment) {
        return assessmentMapper.updateAssessment(assessment);
    }

    // 根据评估ID删除评估记录
    public int deleteAssessmentById(int assessmentId) {
        return assessmentMapper.deleteAssessmentById(assessmentId);
    }
}